package com.mxx.pmxt.util;

/**
 * Created by 马潇霄 on 2017/4/19.
 */
public class PageUtil
{
    int itemNum;//总条数
    int pageSize;//每页显示条数
    int page;//当前页

    public PageUtil(int itemNum, int pageSize, int page)
    {
        this.itemNum = itemNum;
        this.pageSize = pageSize;
        this.page = page;
    }

    public int getPageNum()
    {
        //页数
        int pageNum;
        if (itemNum % pageSize == 0)
        {
            pageNum = itemNum / pageSize;
        } else
        {
            pageNum = itemNum / pageSize + 1;
        }
        return pageNum;
    }

    public int getStartRow(){
        //开始行
        return (page-1) * pageSize;
    }


}
